package com.lungle.warmdiary.app.api.remote;


import com.lungle.warmdiary.app.api.RetrofitClient;

/**
 *@author sbbic
 *created at 2016/9/7 0:12
 */
public enum ApiFactory {
    INSTANCE;

    private static UserApi userApi;
    private static FileApi sFileUploadApi;
    private static BaseApi baseApi;


    ApiFactory() {

    }


    public static UserApi getUserApi() {
        if (userApi == null) {
            userApi = RetrofitClient.INSTANCE.getRetrofit(true).create(UserApi.class);
        }
        return userApi;
    }


    public static FileApi getFileApi() {
        if (sFileUploadApi == null) {
            sFileUploadApi = RetrofitClient.INSTANCE.getRetrofit(true).create(FileApi.class);
        }
        return sFileUploadApi;
    }


    public static BaseApi getBaseApi() {
        if (baseApi == null) {
            ApiFactory.baseApi = RetrofitClient.INSTANCE.getRetrofit(false).create(BaseApi.class);
        }
        return baseApi;
    }

}
